package com.jianger.dao;

import com.jianger.pojo.SessionRandomEx;
import com.jianger.utils.JDBCUtils;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * @author jianger
 * @ date  2018/4/6-12:43
 * @project com.jianger.dao
 */
public class SessionRandomExtractDAOImpl implements ISessionRandomExtractDAO {

    @Override
    public void save(SessionRandomEx sessionRandomEx) {
        QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource());

        String sql = " insert into session_random_extract values (?,?,?,?,?,?)";

        Object[] params = {sessionRandomEx.getTask_id(),
                sessionRandomEx.getSession_id(),
                sessionRandomEx.getStart_time(),
                sessionRandomEx.getClick_categoryids(),
                sessionRandomEx.getSearch_keywords(),
                sessionRandomEx.getEnd_time()
        };

        try {
            qr.update(sql, params);
        } catch (SQLException e) {
            e.printStackTrace();
        }

    }
}
